import 'package:flutter/material.dart';
import 'package:flutter_login/theme/app_colors.dart';
import 'package:flutter_login/theme/app_size.dart';
import 'package:flutter_login/theme/app_style.dart';

// 头部内容
class WelcomeHeaderWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Image.asset("assets/images/bg_welcome_header.png"),
      ],
    );
  }
}

// 按钮渐变组件
class GradientBtnWidget extends StatelessWidget {
  final Key? key;
  final double? width;
  final Widget? child;
  final GestureTapCallback? onTap;

  GradientBtnWidget({this.key, this.width, this.child, this.onTap})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        width: width,
        height: 48,
        decoration: BoxDecoration(
          gradient: kBtnLinearGradient,
          boxShadow: kBtnShadow,
          borderRadius: BorderRadius.circular(kBtnRadius),
        ),
        alignment: Alignment.center,
        child: child,
      ),
    );
  }
}

// 白色按钮文字
class BtnTextWhiteWidget extends StatelessWidget {
  final Key? key;
  final String text;

  BtnTextWhiteWidget({this.key, this.text = ""}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Text(
      text,
      style: kBtnTextStyle.copyWith(
        color: Colors.white,
      ),
    );
  }
}

// 登录按钮
class LoginBtnWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 208,
      height: 48,
      decoration: BoxDecoration(
        color: Colors.white,
        boxShadow: kBtnShadow,
        borderRadius: BorderRadius.circular(kBtnRadius),
      ),
      alignment: Alignment.center,
      child: Text(
        "登录",
        style: kBtnTextStyle,
      ),
    );
  }
}

// 横线
class LineWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: 80,
      child: Divider(
        color: kTextColor,
      ),
    );
  }
}

// 登录方式图标
class LoginTypeIconWidget extends StatelessWidget {
  final String iconName;

  LoginTypeIconWidget(this.iconName);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 10),
      child: Image.asset(
        iconName,
        width: 16,
        height: 16,
      ),
    );
  }
}
